package com.alks.function.controller.stockdept.pcfactorystockquery;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.RoleCheck;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.stockdept.pcfactorystockwork.CsmDetAddRequest;
import com.alks.function.data.request.stockdept.pcfactorystockwork.CsmDetRequest;
import com.alks.function.service.stockdept.pcfactorystockquery.IConsuOutService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;

@RestController
@ApiRestController("/pcFactorStockQuery")
@Api(value = "仓储部查询",tags = "仓储部-仓储工厂作业-耗品出库查询")
@RequiredArgsConstructor
@RoleCheck(prgIds = {"100413","150210","160211","180711","170510"})
public class ConsuOutController {
    private final IConsuOutService service;

    @GetMapping("/getCsmOutTempQuery")
    @ApiOperation(value = "耗品出库查询-待出库明细-查询",tags = "仓储部-仓储工厂作业-耗品出库查询")
    public ResponseInfo getCsmOutTempQuery(){
        return service.getCsmOutTempQuery();
    }

    @PostMapping("/csmOutTempAdd")
    @ApiOperation(value = "耗品出库查询-待出耗品新增-新增",tags = "仓储部-仓储工厂作业-耗品出库查询")
    public ResponseInfo csmOutTempAdd(@RequestParam@ApiParam("物料编号") String mtlNo){
        return service.csmOutTempAdd(mtlNo);
    }

    @PostMapping("/csmOutTempUpdate")
    @ApiOperation(value = "耗品出库查询-待出耗品修改-更新",tags = "仓储部-仓储工厂作业-耗品出库查询")
    public ResponseInfo csmOutTempUpdate(@RequestParam@ApiParam("物料ID") String mtlNo,
                                      @RequestParam(required = false)@ApiParam("数量") BigDecimal qty,
                                      @RequestParam(required = false)@ApiParam("备注") String remark){
        return service.csmOutTempUpdate(mtlNo,qty,remark);
    }

    @PostMapping("/csmOutTempDelete")
    @ApiOperation(value = "耗品出库查询-待出耗品删除-删除",tags = "仓储部-仓储工厂作业-耗品出库查询")
    public ResponseInfo csmOutTempDelete(@RequestParam@ApiParam("物料编号") String mtlNo){
        return service.csmOutTempDelete(mtlNo);
    }

    @PutMapping("/getCsmOutDetQuery")
    @ApiOperation(value = "耗品出库查询-其他材料出库明细-可条件查询",tags = "仓储部-仓储工厂作业-耗品出库查询")
    public ResponseInfo getCsmOutDetQuery(@RequestBody CsmDetRequest request){
        return service.getCsmOutDetQuery(request);
    }

    @PutMapping("/csmOutDetAdd")
    @ApiOperation(value = "耗品出库查询-出库批处理-新增",tags = "仓储部-仓储工厂作业-耗品出库查询")
    public ResponseInfo csmOutDetAdd(@RequestBody CsmDetAddRequest request){
        return service.csmOutDetAdd(request);
    }
    @PostMapping("/csmOutDetailDelete")
    @ApiOperation(value = "耗品出库查询-耗品明细删除-删除",tags = "仓储部-仓储工厂作业-耗品出库查询")
    public ResponseInfo csmOutDetailDelete(@RequestParam@ApiParam("物料ID") String mtlNo,
                                          @RequestParam@ApiParam("入库单号") String slipNo){
        return service.csmOutDetailDelete(mtlNo,slipNo);
    }
}
